<template>
  <div id="cart-list-item">
    <div class="item-selector">
      <CheckButton
        @click.native="checkChange"
        :isChecked="product.checked"
      ></CheckButton>
    </div>
    <div class="item-img">
      <img :src="product.image" alt="" />
    </div>
    <div class="item-info">
      <h3 class="item-title">{{ product.title }}</h3>
      <p class="item-desc">{{ product.desc }}</p>
      <div class="info-bottom">
        <div class="item-price">{{ product.price }}</div>
        <div class="item-count">×{{ product.count }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import CheckButton from "../../../components/content/checkButton/CheckButton.vue";
export default {
  props: {
    product: {
      type: Object,
    },
  },
  data() {
    return {};
  },
  components: {
    CheckButton,
  },
  mounted() {},
  methods: {
    checkChange() {
      this.product.checked = !this.product.checked;
    },
  },
};
</script>

<style lang="less" scoped>
#cart-list-item {
  display: flex;
  justify-content: space-between;
  margin: 10px 5px;
  border-radius: 10px;
  background-color: #fff;
  .item-selector {
    width: 20px;
    display: flex;
    justify-self: center;
    align-items: center;
  }
  .item-img {
    width: 100px;
    height: 140px;
    border-radius: 10px;
    overflow: hidden;
    img {
      width: 100%;
    }
  }
  .item-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 220px;
    h3,
    p {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    p {
      margin-top: -30px;
    }
    .info-bottom {
      display: flex;
      justify-content: space-between;
      margin-bottom: 10px;
      font-size: 20px;
      .item-price {
        color: #ff5500;
      }
      .item-count {
        margin-right: 10px;
        color: #000;
      }
    }
  }
}
</style>
